<template>
  <div>
    <div>
      <FormPanel ref="formPanel" :list="formList" :cols="2" :labelWidth="110" :formType="type" :isSubmitBtn="false" @formChange="formChangeHandle" />
    </div>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }"
    >
      <el-button @click="closeDialog">取 消</el-button>
      <AjaxButton size="small" :click="deliveryHandle" type="primary">发 货</AjaxButton>
    </div>
  </div>
</template>

<script>
import { getOrderInfo, confirmOrder, shippedOrder, closeOrder } from '@/api/part/exchange/query';
export default {
  name: 'Delivery',
  props: ['partPlatformOrderId'],
  data() {
    return {
      formList: this.createDeliveryPanel(),
      type: 'add'
    };
  },
  methods: {
    closeDialog() {
      this.$emit('close');
    },
    // 发货按钮
    async deliveryHandle() {
      let val = await this.$refs.formPanel.GET_FORM_DATA();
      let params = val[1];
      params.partPlatformOrderId = this.partPlatformOrderId;
      let res = await shippedOrder(params);
      if (res.resultCode == 200) {
        // this.$notify.success({ title: '提示信息', message: '发货成功' });
        this.$emit('close', false, true);
        return;
      }
      // this.$notify.error({ title: '提示信息', message: '发货失败' });
      // this.$emit('close', res.data);
    },
    createDeliveryPanel() {
      return [
        {
          type: 'INPUT',
          label: '物流名称',
          fieldName: 'logistics',
          placeholder: '',
          // itemList: this.createDictList('1004'),
          rules: [{ required: true, message: '请输入物流名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '物流单号',
          fieldName: 'deliveryOrderNo',
          placeholder: '',
          // itemList: this.createDictList('1004'),
          rules: [{ required: true, message: '请输入物流单号', trigger: 'blur' }]
        }
      ];
    },
    formChangeHandle() {}
  }
};
</script>

<style></style>
